package com.wx.chapter14.list_;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2023/7/28 - 10:41
 */
public class ListFor {
    public static void main(String[] args) {
        List list = new ArrayList();
        list.add("jack");
        list.add("tom");
        list.add("鱼香肉丝");
        list.add("北京烤鸭子");
        Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            Object obj = iterator.next();
            System.out.println(obj);
        }
        for (Object obj : list) {
            System.out.println(obj);
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
}
